package com.zxc.service;

import com.zxc.enums.Fruit;
import com.zxc.factory.CalculatorFactory;
import com.zxc.pricing.PriceCalculator;

import java.util.Map;

/**
 * 超市服务类
 */
public class SupermarketService {

    // 顾客A的计算方法（苹果和草莓）
    public double calculateCustomerATotal(Map<Fruit, Integer> fruits) {
        PriceCalculator calculator = CalculatorFactory.createCalculatorForCustomerA();
        return calculator.calculateTotal(fruits);
    }

    // 顾客B的计算方法（苹果、草莓和芒果）
    public double calculateCustomerBTotal(Map<Fruit, Integer> fruits) {
        PriceCalculator calculator = CalculatorFactory.createCalculatorForCustomerB();
        return calculator.calculateTotal(fruits);
    }

    // 顾客C的计算方法（草莓8折）
    public double calculateCustomerCTotal(Map<Fruit, Integer> fruits) {
        PriceCalculator calculator = CalculatorFactory.createCalculatorForCustomerC();
        return calculator.calculateTotal(fruits);
    }

    // 顾客D的计算方法（草莓8折 + 满100减10）
    public double calculateCustomerDTotal(Map<Fruit, Integer> fruits) {
        PriceCalculator calculator = CalculatorFactory.createCalculatorForCustomerD();
        return calculator.calculateTotal(fruits);
    }
}
